<script setup>

import {ref, reactive, watch, computed} from 'vue';
import relativeTime from './filters';
// 获取当前时间戳（毫秒）
const timestamp = ref(new Date().getTime())
console.log(timestamp);

function toggleRelativeTime() {
  timestamp.value = relativeTime(timestamp.value)
}
</script>

<template>
  <h2>{{ timestamp }}</h2>
  <el-button @click="toggleRelativeTime">转化为相对时间</el-button>
</template>

<style scoped>

</style>